<%-- 
    Document   : waiting_patient_list
    Created on : 14-dic-2011, 15.00.03
    Author     : guybrush
--%>

<%@page import="beans.util.ExtendedDataTableBean"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@taglib prefix="a4j" uri="http://richfaces.org/a4j"%>
<%@taglib prefix="rich" uri="http://richfaces.org/rich"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<f:view>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title><h:outputText value="#{msg.waiting_patient_list} - #{msg.medic}: #{extendedDataTableBean.username} (#{extendedDataTableBean.nome} #{extendedDataTableBean.cognome})" /></title>
            <link href="<% out.print(request.getContextPath());%>/resources/css/position.css" rel="stylesheet" type="text/css" />
            <% ExtendedDataTableBean med = ((ExtendedDataTableBean) session.getAttribute("extendedDataTableBean")); 
               med.invalidPats(); %>
        </head>
        <body>
            <jsp:include page="/pages/fragments/header.jsp" />
            <h:panelGrid columns="2" columnClasses="col, col">
                <h:column>
                    <jsp:include page="/pages/fragments/medicMenu.jsp" />
                    <rich:spacer height="15px" width="100%" />
                    <jsp:include page="/pages/fragments/ExaminationEditor.jsp" />
                </h:column>
                <h:panelGrid id="all" columns="2" columnClasses="col, col">
                    <rich:panel header="#{msg.patients_list}" style="width: 670px">
                        <a4j:form id="tableP">
                            <rich:extendedDataTable value="#{extendedDataTableBean.waitingPatsDataModel}" var="res" id="table_w"
                                                    width="650px" height="270px" selectionMode="#{extendedDataTableBean.selectionMode}"
                                                    selection="#{extendedDataTableBean.selectionPat}" footerClass="ds" rows="5"
                                                    columnClasses="b2,b2,b2,b2,b2,b2">
                                <f:facet name="header">
                                    <h:outputText value="#{msg.patients}"/>
                                </f:facet>
                                <rich:column sortBy="#{extendedDataTableBean.getMoreCountedPat(res)}" width="60px">
                                    <f:facet name="header" />
                                    <h:graphicImage value="/resources/img/moreWaited/#{extendedDataTableBean.getMoreCountedPat(res)}.png"
                                                    height="30px" width="30px" />
                                </rich:column>
                                <rich:column sortBy="#{res.nome}" width="80px">
                                    <f:facet name="header">
                                        <h:outputText value="#{msg.name}"/>
                                    </f:facet>
                                    <h:outputText value="#{res.nome}"/>
                                </rich:column>
                                <rich:column sortBy="#{res.cognome}" width="100px">
                                    <f:facet name="header">
                                        <h:outputText value="#{msg.surname}"/>
                                    </f:facet>
                                    <h:outputText value="#{res.cognome}"/>
                                </rich:column>
                                <rich:column sortBy="#{res.dataNascita}" width="150px">
                                    <f:facet name="header">
                                        <h:outputText value="#{msg.birthday}"/>
                                    </f:facet>
                                    <h:outputText value="#{res.dataNascita}">
                                        <f:convertDateTime type="date" dateStyle="long" />
                                    </h:outputText>
                                </rich:column>
                                <rich:column sortBy="#{res.age}" width="80px">
                                    <f:facet name="header">
                                        <h:outputText value="#{msg.eta}"/>
                                    </f:facet>
                                    <h:outputText value="#{res.age}" />
                                </rich:column>
                                <rich:column sortBy="#{res.maschio}" width="80px">
                                    <f:facet name="header">
                                        <h:outputText value="#{msg.sesso}"/>
                                    </f:facet>
                                    <h:graphicImage value="/resources/img/genre/#{res.maschio}.jpg" height="30px" width="30px" />
                                </rich:column>
                                <rich:column width="110px">
                                    <f:facet name="header">
                                        <h:outputText value="#{msg.n_rich}"/>
                                    </f:facet>
                                    <h:outputText value="#{extendedDataTableBean.getWaitedPatientCount(res)}" />
                                </rich:column>
                                <f:facet name="footer">
                                    <rich:datascroller id="ds" for="table_w"></rich:datascroller>
                                </f:facet>
                                <a4j:support reRender="tableP, tableE, patEdit, gEdit, examEdit" id="examinations_render"
                                             oncomplete="map.setCenter(new GLatLng(#{extendedDataTableBean.latSingSelctedPat},
                                                         #{extendedDataTableBean.longSingSelctedPat}),#{extendedDataTableBean.gzoom})"
                                             event="onselectionchange" action="#{extendedDataTableBean.takePatSelection}" />
                            </rich:extendedDataTable>
                        </a4j:form>
                        <rich:spacer width="100%" height="20px"/>
                        <jsp:include page="/pages/fragments/ExaminationList.jsp" />
                    </rich:panel>
                    <rich:column>
                        <jsp:include page="/pages/fragments/PatientEditor.jsp" />
                    </rich:column>
                </h:panelGrid>
            </h:panelGrid>
        </body>
    </html>
</f:view>